package com.example.project.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.project.entity.Line;
import com.example.project.mapper.LineMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 路线信息Controller
 *
 * @author changyao
 * @date 2024-11-29
 */
@RestController
@RequestMapping("/project/line")
public class LineController
{
    @Autowired
    private LineMapper lineMapper;

    /**
     * 查询路线信息列表
     */
    @GetMapping("/list")
    public List<Line> list()
    {
        QueryWrapper<Line> queryWrapper=new QueryWrapper<>();
        return lineMapper.selectList(queryWrapper);
    }




    /**
     * 获取路线信息详细信息
     */
    @PostMapping("/detil")
    public Line getInfo(@RequestBody Line line)
    {
        return lineMapper.selectById(line);
    }


    /**
     * 新增路线信息
     */
    @PostMapping("/add")
    public int add(@RequestBody Line line)
    {
        return lineMapper.insert(line);
    }

    /**
     * 修改路线信息
     */
    @PostMapping("/edit")
    public int edit(@RequestBody Line line)
    {
        return lineMapper.updateById(line);
    }

    /**
     * 删除路线信息
     */
	@PostMapping("/del")
    public int remove(@RequestBody Line line)
    {
        return lineMapper.deleteById(line);
    }
}
